package com.example.springbootgraduation.controller;

import com.example.springbootgraduation.entity.NocvGlobalData;
import com.example.springbootgraduation.service.GlobalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

//全球疫情
@Controller
public class GlobalController {

    @Autowired
    private GlobalService globalService;
    /**
     * 跳转全球疫情地图
     */
    @RequestMapping("/toGlobal")
    public String toGlobal(){
        return "global";
    }

    //调用
    @RequestMapping("/queryGlobal")
    @ResponseBody//json实体需要加ResponseBody，前台才能接收
    public List<NocvGlobalData> queryGlobal(){//查询很多数据使用List
        List<NocvGlobalData> list = globalService.list();//拿到数据
        return list;//返回数据
    }
}
